<template>
  <div id="app">
    <!-- 控制缓存与不缓存，路由添加  meta: {keepAlive: true} -->
    <!--要  缓存的路由-->
    <keep-alive>
      <router-view v-if="$route.meta.keepAlive"></router-view>
    </keep-alive>

    <!--不  缓存的路由-->
    <router-view v-if="!$route.meta.keepAlive"></router-view>
  </div>
</template>

<script>
export default {
  created() {
    this.$store.commit("initUser");
  },
};
</script>
